home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
COMMUNIC
/
TERMINAL
/
1589.ZIP
/
TERMCTRL.C
< prev
next >
Wrap
Text File
|
1989-04-13
|
3KB
|
95 lines
#include "windows.h"
#include <stdio.h>
#include <fcntl.h>
#include <stdarg.h>
#include "icu_user.h"
#include "term.h"
#include "termdefs.h"
/**/
/*doc************************************************************************
*
* NAME
*
* ProcessCtrl() - Converts a CONTROL character into Windows commands
*
* FORMAT
*
* ProcessCtrl( Control Character )
*
* DESCRIPTION
* This function was called by ReadLine() when a Control character is
* read. The function performs functions needed to cary out whatever
* function the control character ment.
*
* NOTE: I have not written code for every possible control character.
* I needed the program to handle control characters that were
* thrown out by curses while curses was drawing graphics and stuff.
* Open the Diag. dialog window with verbose on to see if you are
* getting control characters that are not being supported.
*
* RETURN VALUE
* TRUE - Escape sequence was executed
* FALSE - Escape character is not supported.
*
* MODIFIES
*
* REFERENCES
*
*end************************************************************************/
ProcessCtrl( CtrlCode )
char CtrlCode;
{
int i, ReturnValue ;
ReturnValue = TRUE;
TermShowCaret( FALSE ); /* Hide the caret */
switch( CtrlCode ) {
case 0x07: /* Sound BELL */
Beep();
break;
case 0x08: /* Cursor Left */
if ( next_char > 0 ) {
curs_pos.x -= char_w;
next_char--;
}
break;
case 0x0A: /* Cursor Down */
UpdateCursPos(DOWN_LINE); /* Advance to next line- NO CR */
break;
case 0x0B: /* Cursor Up */
if ( next_line > 0 ) {
curs_pos.y -= char_h;
next_line--;
}
break;
case 0x0C: /* Cursor Right */
UpdateCursPos(NEXT_CHAR);
break;
case 0x0D: /* Cursor to Start of Line */
curs_pos.x = char_w;
next_char = 0;
break;
case 0x1E: /* Home Cursor */
next_char = 0;
next_line = 0;
curs_pos.x = char_w;
curs_pos.y = 1;
break;
case 0x1F: /* LineFeed */
fileput("Control- line Feed");
UpdateCursPos(NEXT_LINE); /* Advance to next line */
break;
default:
fileput("Control character [%d]:[%xH] not supported.",CtrlCode,CtrlCode);
ReturnValue = FALSE;
break;
}
TermShowCaret( TRUE ); /* Show the caret */
return( ReturnValue );
} /** End of termCTRL.c **/